<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{$title}</title>
    <meta name="keywords" content="{$title}">
    <meta name="description" content="{$title}">
    <link href="__ADMINCSS__/bootstrap.min14ed.css" rel="stylesheet">
    <link href="__ADMINCSS__/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__ADMINCSS__/animate.min.css" rel="stylesheet">
    <link href="__ADMINCSS__/style.min.css" rel="stylesheet">
    <style type="text/css">
        img{
            width: 50px;
            height: 50px;
        }
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>商品表</h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-2">
                            <div class="input-group">
                                <a href="{:U('add')}" class="btn btn-outline btn-primary ">添加商品</a>
                            </div>
                        </div>
                        <form name="goods_list" id="goods_list" action="{:U()}" method="get">
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input type="text" placeholder="请输入关键词" class="input-sm form-control" name="word" id="word" value="{$word}">
                                    <span class="input-group-btn">
                                        <button type="submit" class="btn btn-sm btn-primary">搜 索</button>
                                    </span>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="hr-line-dashed" style="margin: 10px"></div>
                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>商品名</th>
                                <th>品牌</th>
                                <th>类别</th>
                                <th>缩略图</th>
                                <th>市场价</th>
                                <th>本店价</th>
                                <th>库存</th>
                                <th>积分商品</th>
                                <th>所需积分</th>
                                <th>上架状态</th>
                                <th>精品</th>
                                <th>惊品</th>
                                <th>返积分比例</th>
                                <th>添加时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody id="list_content">
                            <volist name="list" id="v">
                                <tr>
                                    <td>{$v.id}</td>
                                    <td>{$v.goods_name}</td>
                                    <td>{$v.brand_name}</td>
                                    <td>{$v.classification}</td>
                                    <td>
                                        <empty name="v.litimg">
                                            <img alt="image" class="img-thumbnail" src="/Upload/image/goods_img/20170227/58b37c601af48.jpg">
                                            <else />
                                            <img alt="image" class="img-thumbnail" src="{$v.litimg}">
                                        </empty>
                                    </td>
                                    <td>{$v.market_price}</td>
                                    <td>{$v.fd_price}</td>
                                    <td>{$v.number}</td>
                                    <td><a class="btn btn-{$v['is_integral']?'primary':'danger'} btn-xs" href="javascript:;">{$v['is_integral']?'是':'否'}</a></td>
                                    <td>{$v.integral}</td>
                                    <td><a id="sale{$v.id}" class="btn btn-{$v['is_sale']?'primary':'danger'} btn-xs" href="javascript:;" onclick="changeSale({$v.id})">{$v['is_sale']?'已 上 架':'下 架'}</a></td>
                                    <td><a id="boutique{$v.id}" class="btn btn-{$v['is_boutique']?'primary':'danger'} btn-xs" href="javascript:;" onclick="changeBoutique({$v.id})">{$v['is_boutique']?'是':'否'}</a></td>
                                    <td><a id="surprise{$v.id}" class="btn btn-{$v['is_surprise']?'primary':'danger'} btn-xs" href="javascript:;" onclick="changeSurprise({$v.id})">{$v['is_surprise']?'是':'否'}</a></td>
                                    <td><?php echo $v['ret_integral'].'%'?></td>
                                    <td>{$v.add_time|date="Y-m-d H:i",###}</td>
                                    <td>
                                        <a href="javascript:;" class="btn btn-primary btn-xs" onclick="edit({$v.id})"><i class="fa fa-edit"></i> 编 辑</a> &nbsp;&nbsp;
                                        <a href="javascript:;" class="btn btn-danger btn-xs" onclick="del({$v.id})"><i class="fa fa-trash-o"></i> 删 除</a>
                                    </td>
                                </tr>
                            </volist>
                            </tbody>
                        </table>
                        {$page}
                    </div>
                    <div class="spiner-example">
                        <div class="sk-spinner sk-spinner-three-bounce">
                            <div class="sk-bounce1"></div>
                            <div class="sk-bounce2"></div>
                            <div class="sk-bounce3"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__ADMINJS__/jquery.min.js"></script>
<script src="__ADMINJS__/bootstrap.min.js"></script>
<script src="__ADMINJS__/plugins/layer/layer.min.js"></script>
<script src="__ADMINJS__/plugins/laypage/laypage.js"></script>
<script src="__ADMINJS__/plugins/laytpl/laytpl.js"></script>
<script src="__ADMINJS__/common.js"></script>
<script>
    //修改
    function edit(id){
        location.href = '/admin/goods/edit/id/'+id+'.html';
    }

    //删除
    function del(id){
        sxshop.del(id,"{:U('del')}","{:U()}")
    }
    //修改上架状态
    function changeSale(id){
        var objectSale = $('#sale'+id);
        sxshop.sale(id,"{:U('changeSale')}",objectSale);
    }

    //修改加精状态
    function changeBoutique(id){
        var objectBoutique = $('#boutique'+id);
        sxshop.boutique(id,"{:U('changeBoutique')}",objectBoutique);
    }

    //修改加惊状态
    function changeSurprise(id){
        var objectSurprise = $('#surprise'+id);
        sxshop.surprise(id,"{:U('changeSurprise')}",objectSurprise);
    }
</script>
</body>
</html>
